package com.railway.field.controller;

import com.railway.field.entity.Riskshow;
import com.railway.field.entity.Staff;
import com.railway.field.service.RiskshowService;
import com.railway.field.service.StaffService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Api(description = "用户接口")
@RestController
@RequestMapping("PcCount")
@CrossOrigin
public class PcCount {
    @Autowired
    private StaffService staffService;

    @Autowired
    private RiskshowService riskshowService;


    //劳务人员统计数据
    @ApiOperation(value = "根据工种分布统计人数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByWorktype")
    public List<Staff> CountByWorktype(@RequestBody Map map) {
        return staffService.CountByWorktype(map);
    }

    @ApiOperation(value = "根据分包单位分布统计人数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountBySub")
    public List<Staff> CountBySub(@RequestBody Map map) {
        return staffService.CountBySub(map);
    }

    @ApiOperation(value = "根据人员类型分组统计人数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByType")
    public List<Staff> CountByType(@RequestBody Map map) {
        return staffService.CountByType(map);
    }

    @ApiOperation(value = "根据地区分组统计人数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByStaffProvince")
    public List<Staff> CountByStaffProvince(@RequestBody Map map) {
        return staffService.CountByStaffProvince(map);
    }

    @ApiOperation(value = "根据民族分组统计人数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByStaffNation")
    public List<Staff> CountByStaffNation(@RequestBody Map map) {
        return staffService.CountByStaffNation(map);
    }

    @ApiOperation(value = "根据性别分组统计人数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByStaffSex")
    public List<Staff> CountByStaffSex(@RequestBody Map map) {
        return staffService.CountByStaffSex(map);
    }

    @ApiOperation(value = "按照年龄端分组查询" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByStaffAge")
    public List<Staff> CountByStaffAge(@RequestBody Map map) {
        return staffService.CountByStaffAge(map);
    }

    @ApiOperation(value = "劳务人员总数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByTypeLW")
    public List<Staff> CountByTypeLW(@RequestBody Map map) {
        return staffService.CountByTypeLW(map);
    }

    @ApiOperation(value = "管理人员总数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountByTypeGL")
    public List<Staff> CountByTypeGL(@RequestBody Map map) {
        return staffService.CountByTypeGL(map);
    }

    //大屏_安全统计数据
    @ApiOperation(value = "根据隐患类型查询数量总数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountRiskshowByRiskId")
    public List<Riskshow> CountRiskshowByRiskId(@RequestBody Map map) {
        return riskshowService.CountRiskshowByRiskId(map);
    }

    @ApiOperation(value = "根据分包单位查询数量总数" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/CountRiskshowBySubId")
    public List<Riskshow> CountRiskshowBySubId(@RequestBody Map map) {
        return riskshowService.CountRiskshowBySubId(map);
    }

    @ApiOperation(value = "隐患详情" , notes = "测试数据:{\"user_id\":1}")
    @PostMapping("/Select_Riskshow_Month")
    public List<Riskshow> Select_Riskshow_Month(@RequestBody Map map) {
        return riskshowService.Select_Riskshow_Month(map);
    }
}
